var __assign =
  (this && this.__assign) ||
  function () {
    __assign =
      Object.assign ||
      function (t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
          s = arguments[i];
          for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
        }
        return t;
      };
    return __assign.apply(this, arguments);
  };
import {
  SET_ACTIVE_SCHEMA,
  SET_ACTIVE_SCHEMA_CURRENT,
  SET_FORCE_RENDER,
  SET_ITEM_STORE,
  SET_SCHEMA_LIST,
  SET_SCHEMA_MODAL
} from '../constants';
export var ConfigReducer = function (state, action) {
  switch (action.type) {
    case SET_ACTIVE_SCHEMA: {
      return __assign(__assign({}, state), { activeSchema: action.data });
    }
    case SET_ACTIVE_SCHEMA_CURRENT: {
      var activeSchema = state.activeSchema;
      if (activeSchema !== '') {
        activeSchema.current = action.data;
      }
      return __assign(__assign({}, state), { activeSchema: activeSchema });
    }
    case SET_SCHEMA_LIST: {
      return __assign(__assign({}, state), {
        schemaList: action.data.map(function (item) {
          return item;
        })
      });
    }
    case SET_SCHEMA_MODAL: {
      return __assign(__assign({}, state), { onGetSchemaModel: action.data });
    }
    case SET_FORCE_RENDER: {
      return __assign(__assign({}, state), { forceRender: action.data });
    }
    case SET_ITEM_STORE: {
      return __assign(__assign({}, state), { itemStore: action.data });
    }
    default:
      console.log('untouched', action);
      return state;
  }
};
